//
//  CJLog.m
//  CJPack
//
//  Created by 陈警卫 on 2024-05-31.
//

#import "CJLog.h"
#import "CJPack-Swift.h"

@implementation CJLog

+ (void)logWithFilename:(const char *)filename func:(SEL)func linenum:(NSUInteger)linenum format:(NSString *)format, ... {
    va_list args;
    va_start(args, format);
    
    NSString *filen = [NSString stringWithUTF8String:filename];
    NSString *funcname = NSStringFromSelector(func);
    NSInteger linen = linenum;

    NSString *message = [[NSString alloc] initWithFormat:format arguments:args];
    [[[CJPrint alloc] init] logWithMessage:message state:(CJPrintStateLog) filename:filen funcname:funcname linenum:linen];
    
    va_end(args);
}

+ (void)logWithFilename:(const char *)filename func:(SEL)func linenum:(NSUInteger)linenum message:(NSString *)message {
    
    NSString *filen = [NSString stringWithUTF8String:filename];
    NSString *funcname = NSStringFromSelector(func);
    NSInteger linen = linenum;
    
    [[[CJPrint alloc] init] logWithMessage:message state:(CJPrintStateLog) filename:filen funcname:funcname linenum:linen];
}

@end
